<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>添加配置类目</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="stylesheet" href="/static/layui/css/layui.css" />
<link rel="stylesheet" href="/static/ui/css/ui.css" />

    </head>
    <body>
        <form class="layui-form" action="" lay-filter="editform">
            <div class="mainBox">
                <div class="main-container">
                    <div class="main-container">
                        <div class="layui-form-item">
                            <label class="layui-form-label">配置名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入配置名称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">配置标志</label>
                            <div class="layui-input-block">
                                <input type="text" name="key" lay-verify="required" autocomplete="off" placeholder="请输入配置标志" class="layui-input">
                                <div class="layui-form-mid layui-word-aux">不能和系统中该类目下的标志相同</div>
                            </div>
                            
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-block">
                            <input type="radio" name="status" value="0" title="开启" checked>
                            <input type="radio" name="status" value="1" title="关闭">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-block">
                                <textarea name="remark" placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
            <div class="bottom">
                <div class="button-container">
                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="user-save">
                        <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
                </div>
            </div>
        </form>
        <script src="../config.js"></script>
        <script src="/static/layui/layui.js"></script>
		<script src="/static/ui/ui.js"></script>
        <script>
            layui.use(['form', 'layer'], function () {
                let form = layui.form,
                    layer = layui.layer,
                    $ = layui.$;

                //监听提交
                form.on('submit(user-save)', function (data) {
                    data = data.field;
                    _post(layui, 'set/add', data, res => {
                        //console.log(res)
                        parent
                            .layui
                            .table
                            .reload("set-table");
                        parent
                            .layer
                            .close(parent.layer.getFrameIndex(window.name)); //关闭当前页

                    })

                    return false;
                });

            });
        </script>

    </body>
</html>